package tpase.client.VO;

import it.unisa.dia.gas.jpbc.Element;
import it.unisa.dia.gas.jpbc.Field;
import it.unisa.dia.gas.jpbc.Pairing;
import tpase.util.Util;

import java.util.HashMap;
import java.util.Map;

public class PublicParam {
    private Map<String, byte[]> map = new HashMap<>();
    public PublicParam(String jpbcPath) {
        Element g1, g2, g3, g4, g5, gT;

        Pairing pairing = Util.getPairing(jpbcPath);
        Field G1 = pairing.getG1();
        g1 = G1.newRandomElement();
        Field G2 = pairing.getG2();
        g2 = G2.newRandomElement();
        Field G3 = pairing.getZr();
        g3 = G3.newRandomElement();
        Field G4 = pairing.getG2();
        g4 = G4.newRandomElement();
        Field G5 = pairing.getGT();
        g5 = G5.newRandomElement();
        Field GT = pairing.getGT();
        gT = GT.newRandomElement();

        map.put("g1", g1.toBytes());
        map.put("g2", g2.toBytes());
        map.put("g3", g3.toBytes());
        map.put("g4", g4.toBytes());
        map.put("g5", g5.toBytes());
        map.put("gT", gT.toBytes());

    }

    public PublicParam() {
    }

    public Map<String, byte[]> getMap() {
        return map;
    }

    public void setMap(Map<String, byte[]> map) {
        this.map = map;
    }
}
